package com.kly.smartbi.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kly.smartbi.model.dto.chart.ChartAddRequest;
import com.kly.smartbi.model.dto.chart.ChartQueryRequest;
import com.kly.smartbi.model.entity.Chart;
import com.kly.smartbi.model.vo.ChartVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
* @author admin
* @description 针对表【chart(分析表格信息表)】的数据库操作Service
* @createDate 2025-03-29 08:50:02
*/
public interface ChartService extends IService<Chart> {

    /**
     * 校验
     *
     * @param chart
     * @param add
     */
    void validChart(Chart chart, boolean add);

    /**
     * 获取查询条件
     *
     * @param chartQueryRequest
     * @return
     */
    QueryWrapper<Chart> getQueryWrapper(ChartQueryRequest chartQueryRequest);


    /**
     * 获取帖子封装
     *
     * @param chart
     * @param request
     * @return
     */
    ChartVO getChartVO(Chart chart, HttpServletRequest request);

    /**
     * 分页获取帖子封装
     *
     * @param chartPage
     * @param request
     * @return
     */
    Page<ChartVO> getChartVOPage(Page<Chart> chartPage, HttpServletRequest request);

    /**
     * 添加图表 AI
     *
     * @param chartAddRequest
     * @param file
     * @return
     */
    ChartVO genChartByAi(ChartAddRequest chartAddRequest, MultipartFile file);


    /**
     * 添加图表 AI 队列
     * @param chartAddRequest
     * @param file
     * @return
     */
    ChartVO genChartByAiWithMq(ChartAddRequest chartAddRequest, MultipartFile file);

    /**
     * 生成 csv 文件
     * @param file
     * @return
     */
    StringBuilder genCsvFile(MultipartFile file);
}
